package com.jsh.controller;

import com.sun.corba.se.spi.ior.ObjectKey;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RefreshScope //允许远端配置修改自动刷新
@RestController
@RequestMapping("/nacos/config")
@Api(value = "nacos配置中心测试" ,tags="配置中心")
public class NacosConfigController {

    @Value("${project.name}")
    private String name;

    @Value("${project.author}")
    private String author;



    @ApiOperation("测试全局配置")
    @GetMapping("/get")
    public Map<String, Object> getConfig(){
        Map<String, Object> map = new HashMap<>();
        map.put("project-name",name);
        map.put("project-author",author);

        return map;
    }
}
